var app = require("express")();
var mysql = require("mysql");
var connection = mysql.createConnection({
  host     : 'localhost',
  user     : 'root',
  password : 'root',
  database : 'libaiwu'
});
// connection.connect();

//路由接口
app.get("/mysql",function (req,res) {
  //获取过来的内容
  console.log(req.query);
  // var cont = req.query.cont;
  //sql语句 查
  // var query = "INSERT INTO liuyan(id,cont,time) VALUES(null,'"+cont+"','2018')";
});


//执行
// connection.query(query,function (err, result) {
//     if(err){
//         console.log('[SELECT ERROR] - ',err.message);
//     }else {
//         console.log(result);
//     }
//
// });

//过滤文件
app.get("*",function (req,res) {
  res.send(__dirname+req.url);
})

//关闭
// connection.end();

app.listen(8081);
